package com.tuni.birthdaymoney.persistence.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import com.tuni.birthdaymoney.persistence.entity.Operation;
import com.tuni.birthdaymoney.persistence.entity.Person;

public interface OperationRepository extends JpaRepository<Operation, Integer>, QueryDslPredicateExecutor<Operation> {

    public Operation findById(Integer id);

    public Iterable<Operation> findByReceiptor(Person receiptor);

    public Iterable<Operation> findByReceiptorAndYear(Person receiptor, int year);
    
    public Iterable<Operation> findByReceiptorAndDonatorAndYear(Person receiptor, Person donator, int year);
}
